#include <stdio.h>

void swap(int* a1, int* a2)
{
    int tmp = *a1;
    *a1 = *a2;
    *a2 = tmp;
}

void sort(int* array, unsigned int nCnt)
{
    for (unsigned int i = 0; i < nCnt - 1; ++i)
    {
        for (unsigned int k = 0; k < nCnt - 1 - i; ++k)
        {
            if (array[k] > array[k + 1])
                swap(&array[k], &array[k + 1]);
        }
    }
}

int main()
{
    int array[] = { 2,8,5,1,3,11,2,7 };

    sort(array, sizeof(array) / sizeof(int));

    for (unsigned int i = 0; i < (sizeof(array) / sizeof(int)); ++i)
        printf("%d ", array[i]);
    puts("");

    return 0;
}